<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <style>
            *{
                margin: 0px;
                padding: 0px;
                list-style: none;
            }
            h1{
                color:red;
                font-size: 100px;
                text-align: center;
                margin-top: 20px;
                font-family: 楷体;
            }
            p{
                text-align: center;
                margin-top: 42px;
            }
            button{
                background: rgb(64, 152, 224);
                color: white;
            }
        </style>
    </head>
    <body>
        <h1 id="txt">开始抽奖吧</h1>
        <p>
            <button id="start">开始</button>
            <button id="end">结束</button>
        </p>
        <script>
            var start=document.getElementById('start')
            var end=document.getElementById('end')
            var txt=document.getElementById('txt');
            var timer;
            var list=['张三','李四','王五','aa','bb','cc'];
            console.log(list[0]);
            console.log(list.length)
            start.onclick=function(){
                clearInterval(timer)
               timer=setInterval(function(){
                    var n=parseInt(Math.random()*list.length);
                    txt.innerHTML=list[n];
                },100)
            }
            end.onclick=function(){
                clearInterval(timer);
            }
        </script>
    </body>
</html>